<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件绑定</title>
    <script src="js/vue.js"></script>
</head>
<body>

<div id="app">
    <p>@事件名称帮绑定相应的事件 v-on：可以简写为@</p>
    {{sum}}
    <p> {{sum > 10 ? "大于10" : "小于10"}} </p>
    <input type="button" value="增加" @click="increment(1)">
    <input type="button" value="减少" @click="reduce(1)">


</div>

<script>
    new Vue({
        el:"#app",
       data:{
          sum:0,
       },
        methods:{
            increment: function (num) {
                this.sum += num;
            },
            reduce: function (num) {
                this.sum -= num;
            }
        }
    });
</script>
</body>
</html>